import { ExtractPropTypes, PropType } from "vue";
import { CodeListItem } from "@ibiz-template/runtime";
import { IAppCodeList } from "@ibiz/model-core";

export const codeListProps = {
  codeListItems: {
    type: Array<CodeListItem>,
  },
  codeList: {
    type: Object as PropType<IAppCodeList>,
    required: true,
  },
  value: {
    type: [String, Number],
  },
  convertToCodeItemText: {
    type: Boolean,
    default: true,
  },
  valueFormat: {
    type: String,
  },
  unitName: {
    type: String,
  },
  showMode: {
    type: String as PropType<"DEFAULT" | "ICON" | "TEXT">,
    default: "DEFAULT",
  },
};

export type CodeListProps = ExtractPropTypes<typeof codeListProps>;
